# -*- coding: utf-8 -*-
# @File      :函数重载
# @Author    :liaogan
# @Datetime  :2023/3/7 14:16

def add(a, b):
    return a + b

def add(a, b, c):
    return a + b + c



def add1(a, b, c=None):
    if c is None:
        return a + b
    else:
        return a + b + c

def add1(*args):
    if len(args) == 2:
        return args[0] + args[1]
    elif len(args) == 3:
        return args[0] + args[1] + args[2]
    elif len(args) == 4:
        return args[0] + args[1] + args[2] + args[3]
    else:
        raise TypeError('add() takes 2 or 3 arguments')




if __name__ == '__main__':
    # print(add(2, 5, 7))
    print(add1(1,9))
    print(add1(6,5,8,123))